package com.apes.fn.fico.settleExpense;

import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 结算费用
 *
 * @author wuq
 * @create 2020-04-16 19:37
 */
@Service
public class SettleExpenseService extends DomainService {

    @Autowired
    SettleExpenseRepository settleExpenseRepository;

    public SettleExpense create(SimpleRequest request) {
        SettleExpense settleExpense = request.getO(SettleExpense.class);
        settleExpense.setCreateDate(new Date());
        return save(settleExpense);
    }

    public SettleExpense save(SettleExpense settleExpense) {
        settleExpense.setCreateDate(new Date());
        return settleExpenseRepository.saveAndFlush(settleExpense);
    }
}
